package main

import (
	"GoStart/z_demo/demo_net/host"
	"fmt"
	"net"
)

const (
	A = 1 << iota
	B = 1 << iota
	C = 1 << iota
	D = 1 << iota
	E = 1 << iota
	F = 1 << iota
)

func main() {
	address := ":0"
	fmt.Println(3 & 1) // 11    1
	fmt.Println(2 & 1) // 10    1
	lis, err := net.Listen("tcp", address)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(host.ExtractHostPort("192.168:0"))
	fmt.Println(host.Port(lis))

	if addr, ok := lis.Addr().(*net.TCPAddr); ok {
		fmt.Println(addr.Port)
	}

	extract, err := host.Extract(address, lis)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(extract)

}
